function setMenu()
{
  var curpath = window.location.pathname
  if (curpath === '/display/oa' || curpath === '/display/oc') {
    $("[href='"+curpath+"']").closest('ul').closest("li").addClass('active').closest('ul').closest("li").addClass('active').siblings().removeClass('active')
  }
  else if(curpath == '/display/op')
    $("[href='"+curpath+"']").closest('ul').closest("li").addClass('active')
  else if(curpath == '/display/du') {
    $("[href='"+curpath+"']").closest("li").addClass('active').siblings().removeClass('active')
  }
}

function addAddr( data , province , city , func ) {
	var html = "<option value=''>== 请选择 ==</option>";
	$("#city").append(html);
	$.each(data , function(idx,item){
		html += "<option value='" + idx + "'>" + idx + "</option>";
	});
	$("#province").append(html);

	$("#province").change(function(){
		$("#city option").remove();
		var value = $(this).find("option:selected").val();
		var html = "<option value=''>== 请选择 ==</option>";
		$.each(data,function(idx,item){
			if (value == idx) {
				$.each(item,function(i,ele){
					html += "<option value='" + ele + "'>" + ele + "</option>";
				});
			}
		});
		$("#city").append(html);
		$("#city").change();
	});

  $("#city").change( function() {
      func();
  })

	//绑定
	if(province)
	{
		$("#province").val(province);
	}
	$("#province").change();
	if(city)
	{
		$("#city").val(city);
	}
	$("#city").change();
}

export {
  setMenu,
  addAddr
}
